//
//  MyBraCreateNewActViewController.m
//  ShangHaiHuDongApp
//
//  Created by 刘应平 on 2017/6/15.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "MyBraCreateNewActViewController.h"
#import "LPCostomLabelAndTextFieldAndImageView.h"
#import "ZJSIScopeView.h"
#import "LPCostomLabelAndTextViewAdaptHeightView.h"
#import "JCAlertView.h"
#import "LCustomAlertView.h"
#import "ZJSILocationView.h"
#import "LPCostomJudgeIsOrFalseView.h"
#import "ZJIssueOrganizationSelectView.h"
#import "YBPopupMenu.h"
@interface MyBraCreateNewActViewController ()<LPCostomLabelAndTextFieldAndImageViewDelegate,ZJSIScopeViewDelegate,LPChooseYearAndMonthAndDayAndHourAndMinuteDelegate,LCustomAlertDelegate,ZJSILocationViewDelegate,LPCostomJudgeIsOrFalseDelegate,ZJIssueOrganizationSelectViewDelegate>{

    BOOL _isStreet;
    NSString *_organizationType;/**< 党组织类型 0:街镇党组织(默认)  1：大口党组织 */
    ZJIssueOrganModel *_organModel;/**< 大口党组织--选中的党组织信息 */
}
/**  日期  */
@property (strong, nonatomic) LPCostomLabelAndTextFieldAndImageView  *timeView;
/**  时间  */
@property (strong, nonatomic) NSString  *timeString;
/**  日期  */
@property (strong, nonatomic) LPCostomLabelAndTextFieldAndImageView  *endTimeView;
/**  时间  */
@property (strong, nonatomic) NSString  *endtimeString;


/**  活动地址  */
@property (strong, nonatomic) ZJSILocationView  *actAddress;
/**  经度  */
@property (strong, nonatomic) NSString  *lngString;
/**  纬度  */
@property (strong, nonatomic) NSString  *latString;

/**  标题  */
@property (strong, nonatomic) LPCostomLabelAndTextFieldAndImageView  *matterView;
/**  是否是党员日  */
@property (strong, nonatomic) LPCostomJudgeIsOrFalseView  *partyDay;

/** 线上，线下*/
@property (nonatomic, strong) ZJSIScopeView *onlineTopBotton;
/**  线下线上的值  */
@property (strong, nonatomic) NSString  *OnlineString;

/**    */
@property (strong, nonatomic) NSString  *partyDayString;
/**  是否是志愿活动  */
@property (strong, nonatomic) LPCostomJudgeIsOrFalseView  *volunteerAct;
/**  志愿活动标题数组  */
@property (strong, nonatomic) NSMutableArray  *volunteerDayTitlesArray;
/**  志愿活动数组  */
@property (strong, nonatomic) NSArray  *volunteerDayArray;
/**  是否志愿者活动上传的值  */
@property (strong, nonatomic) NSString  *volunteerActString;
/**  志愿者活动的CODE_VALUE  */
@property (strong, nonatomic) NSString  *CODE_VALUE;



/**  提交  */
@property (strong, nonatomic) UIButton  *sendButton;
/**  scrollView  */
@property (strong, nonatomic) UIScrollView  *backScrollView;
/** 公开范围 */
@property (nonatomic, strong) ZJSIScopeView *scopeView;
/**  范围n  */
@property (strong, nonatomic) NSString  *scopeString;
/**  共享人数  */
@property (strong, nonatomic) LPCostomLabelAndTextFieldAndImageView  *shareNumber;

/**  简介  */
@property (strong, nonatomic) LPCostomLabelAndTextViewAdaptHeightView  *jianjie;

/** 公开范围数据  */
@property (strong, nonatomic) NSArray  *data;
/**  时间选择  */
@property (strong, nonatomic)  LPChooseYearAndMonthAndDayAndHourAndMinuteView *pickTime;

/**  判断是否是第一次  */
@property (assign, nonatomic) BOOL   isFirst;
/**    */
@property (strong, nonatomic) JCAlertView  *jcAlertView;
/**  判断是选择的某个时间  */
@property (assign, nonatomic) NSInteger  timeTag;
/** 当前年月  */
@property (strong, nonatomic) NSString  *currentDay;
/** 发布页面--大口党组织--组织选择的弹窗视图 */
@property (nonatomic, strong) ZJIssueOrganizationSelectView *organizationSelectView;
@end

@implementation MyBraCreateNewActViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.CODE_VALUE = @"";
    self.currentDay = [NSDateFormatter stringWithDate:[NSDate date]];
    self.titlelabel.text = @"发布活动";
    self.scopeString = @"1";
    self.isFirst = YES;
    self.partyDayString = @"0";
    self.volunteerActString = @"0";
    self.latString = @"";
    self.lngString = @"";
    _organizationType = @"0";
    self.OnlineString = @"0";
    
    /**  布局  */
    [self layoutUI];
    [self judgeOrganizationType];
   
    
}


- (void)layoutUI{
    [self.view addSubview:self.backScrollView];
    [self.backScrollView addSubview:self.matterView];
    if ([self.bigClass integerValue] == 2) {
        [self.backScrollView addSubview:self.volunteerAct];
    }else if ([self.bigClass integerValue] == 1 ){
        if ([self.smallClass integerValue] == 1 || [self.smallClass integerValue] == 4) {
            [self.backScrollView addSubview:self.onlineTopBotton];
        }
    
    }
    
    [self.backScrollView addSubview:self.partyDay];
    [self.backScrollView addSubview:self.timeView];
    [self.backScrollView addSubview:self.endTimeView];
    [self.backScrollView addSubview:self.shareNumber];
    [self.backScrollView addSubview:self.actAddress];
    [self.backScrollView addSubview:self.scopeView];
    [self.backScrollView addSubview:self.jianjie];
    [self.backScrollView addSubview:self.sendButton];
    
    self.matterView.sd_layout
    .topSpaceToView(self.backScrollView, 20 * [UIScreen zj_screenHScale])
    .leftEqualToView(self.backScrollView)
    .rightEqualToView(self.backScrollView)
    .heightIs(self.matterView.height);
    
    
    self.volunteerAct.sd_layout
    .topSpaceToView(self.matterView, 10 * [UIScreen zj_screenHScale])
    .leftEqualToView(self.backScrollView)
    .rightEqualToView(self.backScrollView)
    .heightIs(self.volunteerAct.height);
    
    
    /**  针对组织生活和活动的处理，如果是组织生活就没有  */
    if ([self.bigClass integerValue] == 2) {
        self.partyDay.sd_layout
        .topSpaceToView(self.volunteerAct, 15 * [UIScreen zj_screenHScale])
        .leftEqualToView(self.backScrollView)
        .rightEqualToView(self.backScrollView)
        .heightIs(self.partyDay.height);
        
    }else if ([self.bigClass integerValue] == 1 ){
        if ([self.smallClass integerValue] == 1 || [self.smallClass integerValue] == 4) {
            
            self.onlineTopBotton.sd_layout
            .topSpaceToView(self.matterView, 10 * [UIScreen zj_screenHScale])
            .leftEqualToView(self.backScrollView)
            .rightEqualToView(self.backScrollView)
            .heightIs(self.onlineTopBotton.height);
            
            self.partyDay.sd_layout
            .topSpaceToView(self.onlineTopBotton, 15 * [UIScreen zj_screenHScale])
            .leftEqualToView(self.backScrollView)
            .rightEqualToView(self.backScrollView)
            .heightIs(self.partyDay.height);
        }else{
            self.partyDay.sd_layout
            .topSpaceToView(self.matterView, 10 * [UIScreen zj_screenHScale])
            .leftEqualToView(self.backScrollView)
            .rightEqualToView(self.backScrollView)
            .heightIs(self.partyDay.height);
        
        }
        
    }
    
    self.timeView.sd_layout
    .topSpaceToView(self.partyDay, 10 * [UIScreen zj_screenHScale])
    .leftEqualToView(self.backScrollView)
    .rightEqualToView(self.backScrollView)
    .heightIs(self.timeView.height);
    
    self.endTimeView.sd_layout
    .topSpaceToView(self.timeView, 20 * [UIScreen zj_screenHScale])
    .leftEqualToView(self.backScrollView)
    .rightEqualToView(self.backScrollView)
    .heightIs(self.endTimeView.height);
    
    self.shareNumber.sd_layout
    .topSpaceToView(self.endTimeView, 20 * [UIScreen zj_screenHScale])
    .leftEqualToView(self.backScrollView)
    .rightEqualToView(self.backScrollView)
    .heightIs(self.shareNumber.height);
    
    self.actAddress.sd_layout
    .topSpaceToView(self.shareNumber, 20 * [UIScreen zj_screenHScale])
    .leftEqualToView(self.backScrollView)
    .rightEqualToView(self.backScrollView)
    .heightIs(self.actAddress.height);
    
    self.scopeView.sd_layout
    .topSpaceToView(self.actAddress, 20 * [UIScreen zj_screenHScale])
    .leftEqualToView(self.backScrollView)
    .rightEqualToView(self.backScrollView)
    .heightIs(self.scopeView.height);
    
    self.jianjie.sd_layout
    .topSpaceToView(self.scopeView, 20 * [UIScreen zj_screenHScale])
    .leftEqualToView(self.backScrollView)
    .rightEqualToView(self.backScrollView)
    .heightIs(self.jianjie.height);
    
    self.sendButton.sd_layout
    .topSpaceToView(self.jianjie, 40 * [UIScreen zj_screenHScale])
    .leftSpaceToView(self.backScrollView,40 * [UIScreen zj_screenWScale])
    .rightSpaceToView(self.backScrollView,40 * [UIScreen zj_screenWScale])
    .heightIs(self.sendButton.height);
    
    
    [self.backScrollView setupAutoContentSizeWithBottomView:self.sendButton bottomMargin:60 * [UIScreen zj_screenHScale]];
}

#pragma mark - 判断是 街镇党组织 还是 大口党组织
- (void)judgeOrganizationType{
   
    __weak typeof(self) weakSelf = self;
    NSDictionary *dict = @{@"FROM_UNITID":[NSString string:ZJUSERINFORMODEL.CURRENT_ROLE_MODEL.DEPT_ID isNilStringReturnDeftString:@""]};
    [NetWorkingManager postWithUrlString:[NetWorkingURL getTree] Parameter:dict Success:^(id object) {
       
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString:@"20000"]) {
            /**  整理志愿者活动数据  */
            [weakSelf clearUpvolunteer:object];
            _organizationType = [object objectForKey:@"ISDOWN"];
            if ([[object objectForKey:@"ISDOWN"] isEqualToString:@"0"]) {//街镇党组织
                //三个： 全区  街镇党组织  本支部
                weakSelf.organizationSelectView.dataArray = [[NSArray yy_modelArrayWithClass:[ZJIssueOrganModel class] json:[object objectForKey:@"DEPT_TREE"]] mutableCopy];
                [weakSelf getUserTypeUpdateScopeView];
            }else{//大口党组织
                [weakSelf.scopeView minUpdataUI_dataArray:@[@"本支部",@"组织选择",@"全区"] selectString:nil];
                weakSelf.organizationSelectView.dataArray = [[NSArray yy_modelArrayWithClass:[ZJIssueOrganModel class] json:[object objectForKey:@"DEPT_TREE"]] mutableCopy];
            }
        }
    } Fail:^(id object) {
        
    }];
}

- (void)clearUpvolunteer:(NSDictionary *)obj{
    self.volunteerDayArray = [obj objectForKey:@"VOL_TYPE_LIST"];
    self.volunteerDayTitlesArray = [NSMutableArray array];
    for (NSDictionary *data in self.volunteerDayArray) {
        [self.volunteerDayTitlesArray addObject:[data objectForKey:@"CODE_NAME"]];
    }

}

#pragma mark - 判断当前用户身份--来改变功盖范围的UI界面
- (void)getUserTypeUpdateScopeView{
    __weak typeof(self) weakSelf = self;
    //是书记    0支部    1 街道
    [self netWorking_secretary:^(NSString *secretaryType) {
        if ([secretaryType isEqualToString:@"1"]) {//街道的书记、
            [weakSelf.scopeView minUpdataUI_dataArray:@[@"街镇党组织",@"全区"] selectString:nil];
            _scopeString = @"2";
            _isStreet = YES;
        }
    }];
    
}

- (void)netWorking_secretary:(void(^)(NSString * secretaryType))secretary{
    [NetWorkingManager postWithUrlString:[NetWorkingURL informactsSelectValue] Parameter:@{@"ACCOUNTID":ZJUSERINFORMODEL.ORG_ACCOUNT.ID} Success:^(id object) {
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString:@"20000"]) {
            secretary([object objectForKey:@"DEPTTYPE_DSCODE_VALUE"]);
        }
    } Fail:^(id object) {
        
    }];
    
}


#pragma mark - LCustomAlertDelegate
- (void)lCustomAlertWithView:(LCustomAlertView *)view index:(NSInteger)index{
    if (index == 1) {
        self.isFirst = NO;
        [self clickButton];
    }
    
    [self.jcAlertView dismissWithCompletion:nil];
}

/**  发布活动 */
- (void)clickButton{
    
    if (self.matterView.secondTextField.text.length == 0) {
        [YJProgressHUD showMsgWithoutView:@"请输入标题"];
        [self.matterView.secondTextField becomeFirstResponder];
        return;
    }
    if (self.shareNumber.secondTextField.text.length == 0) {
        [YJProgressHUD showMsgWithoutView:@"请输入人数"];
        [self.shareNumber.secondTextField becomeFirstResponder];
        return;
    }
    if (self.timeView.secondTextField.text.length == 0) {
        [YJProgressHUD showMsgWithoutView:@"请选择开始时间"];
        return;
    }
    if (self.endTimeView.secondTextField.text.length == 0) {
        [YJProgressHUD showMsgWithoutView:@"请选择结束时间"];
        return;
    }
    
    if (self.actAddress.loactionLabel.text.length == 0) {
        [YJProgressHUD showMsgWithoutView:@"请输入地址"];
        [self.actAddress.loactionLabel becomeFirstResponder];
        return;
    }
    if (self.jianjie.adaptTextView.text.length == 0) {
        [YJProgressHUD showMsgWithoutView:@"请输入简介"];
        [self.jianjie.adaptTextView becomeFirstResponder];
        return;
    }
    NSInteger time = [NSDate returnMaxDateFormDate:[NSDateFormatter dateHourAndMintueWithString:self.endTimeView.secondTextField.text] lastFate:[NSDateFormatter dateHourAndMintueWithString:self.timeView.secondTextField.text]];
    if (time != 1) {
        [YJProgressHUD showMsgWithoutView:@"请选择正确的时间"];
        return;
    }
    
    __weak typeof(self) weakSelf = self;
    
    NSMutableDictionary *paramer = [NSMutableDictionary dictionary];
    NSString *isFirst;
    if (self.isFirst) {
        isFirst = @"1";
    }else{
        isFirst = @"2";
    }
    paramer[@"NAME"] = self.matterView.secondTextField.text;
    paramer[@"START_TIME"] = self.timeView.secondTextField.text;
    paramer[@"END_TIME"] = self.endTimeView.secondTextField.text;
    paramer[@"ADDRESS"] = self.actAddress.loactionLabel.text;
    paramer[@"POINT_X"] = self.latString;
    paramer[@"POINT_Y"] = self.lngString;
    paramer[@"PUBLISH_ORG"] = self.scopeString;
    paramer[@"DESCRIPTION"] = self.jianjie.adaptTextView.text;
    paramer[@"BIG_CLASS"] = self.bigClass;
    paramer[@"SMALL_CLASS"] = self.smallClass;
    paramer[@"DEPTID"] = ZJUSERINFORMODEL.CURRENT_ROLE_MODEL.DEPT_ID;
    paramer[@"USER_ID"] = ZJUSERINFORMODEL.CURRENT_USER_MODEL.ID;
    paramer[@"ISFIRST"] = isFirst;
    paramer[@"STATUS"] = @"1";
    paramer[@"ISTHEME"] = self.partyDayString;
    paramer[@"SHARE_NUM"] = self.shareNumber.secondTextField.text;
    paramer[@"CREATE_ACCOUNT"] = ZJUSERINFORMODEL.ORG_ACCOUNT.ID;
    paramer[@"IS_VOLUNTEER"] = self.volunteerActString;
    paramer[@"VOL_TYPE"] = self.CODE_VALUE;
    paramer[@"SENDTO_DAPTID"] = @"";
    paramer[@"ONLINE"] = self.OnlineString;
    if ([_organizationType isEqualToString:@"1"]) {//大口党组织
        if ([_scopeString isEqualToString:@"1"]) {//本支部
            paramer[@"SENDTO_DAPTID"] = [NSString string:ZJUSERINFORMODEL.CURRENT_ROLE_MODEL.DEPT_ID isNilStringReturnDeftString:@""];
        }else if ([_scopeString isEqualToString:@"2"]) {//组织选择
            paramer[@"SENDTO_DAPTID"] = [NSString string:_organModel.ID isNilStringReturnDeftString:@""];
        }else if ([_scopeString isEqualToString:@"3"]) {//全区
            ZJIssueOrganModel *orgmodel = self.organizationSelectView.dataArray[0];
            paramer[@"SENDTO_DAPTID"] = [NSString string:orgmodel.ID isNilStringReturnDeftString:@""];
        }
    }else{//街镇党组织
        //self.organizationSelectView.dataArray三个： 全区  街镇党组织  本支部
        if ([_scopeString isEqualToString:@"1"]) {//本支部
            ZJIssueOrganModel *orgmodel = self.organizationSelectView.dataArray[2];
            paramer[@"SENDTO_DAPTID"] = [NSString string:orgmodel.ID isNilStringReturnDeftString:@""];
        }else if ([_scopeString isEqualToString:@"2"]) {//街道党组织
            ZJIssueOrganModel *orgmodel = self.organizationSelectView.dataArray[1];
            paramer[@"SENDTO_DAPTID"] = [NSString string:orgmodel.ID isNilStringReturnDeftString:@""];
        }else if ([_scopeString isEqualToString:@"3"]) {//全区
            ZJIssueOrganModel *orgmodel = self.organizationSelectView.dataArray[0];
            paramer[@"SENDTO_DAPTID"] = [NSString string:orgmodel.ID isNilStringReturnDeftString:@""];
        }
    }

    [YJProgressHUD showMessage:@"发布中..." duration:10 view:self.view];
    [NetWorkingManager postWithUrlString:[NetWorkingURL getactmactionPublishAct] Parameter:paramer Success:^(id object) {
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString:@"20000"]) {
             [MobClick event:[UMMStatisticsString publishAct]];
            [YJProgressHUD showMessage:@"发布成功" inView:weakSelf.view];
            if (weakSelf.block) {
                weakSelf.block();
            }
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [weakSelf.navigationController popViewControllerAnimated:YES];
            });
            
        }else if ([model.STATE isEqualToString:@"56691"]){
         ;
            
//            [NSString string:[object objectForKey:@"DEPTNAME"] isNilStringReturnDeftString: nil]
            UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"该信息需经上级党组织审核后发布,您确定要继续吗" message:nil preferredStyle:UIAlertControllerStyleAlert];
            [alertController addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                weakSelf.isFirst = NO;
                [weakSelf clickButton];
            }]];
            [alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
                
            }]];
            [weakSelf presentViewController:alertController animated:YES completion:nil];
            
            
            
        }else{
            [YJProgressHUD showSuccess:@"发布失败" inview:weakSelf.view];
        }
    } Fail:^(id object) {
        [YJProgressHUD showSuccess:@"发布失败" inview:weakSelf.view];
    }];
    
    
}


#pragma mark - LPCostomJudgeIsOrFalseDelegate
- (void)LPCostomJudgeIsOrFalseWithView:(LPCostomJudgeIsOrFalseView *)view clickIndex:(NSInteger)index{
    self.CODE_VALUE = [self.volunteerDayArray[index] objectForKey:@"CODE_VALUE"];

}


- (void)LPCostomJudgeIsOrFalseWithView:(LPCostomJudgeIsOrFalseView *)view Status:(BOOL)seleted{
    if (view.tag == 1) {
        /**  主题日活动  */
        if (seleted) {
            self.partyDayString = @"1";
           
        }else{
            self.partyDayString = @"0";
            
            
        }
 
    }else{
        /**  志愿活动  */
        if (seleted) {
            self.volunteerActString = @"1";
            self.volunteerAct.sd_layout.heightIs(68 * [UIScreen zj_screenHScale]);
            [self.volunteerAct updateLayout];
            self.volunteerAct.showStringArray = self.volunteerDayTitlesArray;
            self.CODE_VALUE = [self.volunteerDayArray[0] objectForKey:@"CODE_VALUE"];
        }else{
            self.volunteerActString = @"0";
            self.volunteerAct.sd_layout.heightIs(40 * [UIScreen zj_screenHScale]);
            [self.volunteerAct updateLayout];
            self.volunteerAct.showStringArray = @[];
            self.CODE_VALUE = @"";
        }

    }
}

#pragma mark - ZJSILocationViewDelegate
- (void)ZJSILocationViewDelegate_latitude:(NSString *)latitude longitude:(NSString *)longitude{
    self.latString = latitude;
    self.lngString = longitude;
    
}

#pragma mark - LPCostomLabelAndTextFieldAndImageViewDelegate
- (void)LPCostomLabelAndTextFieldAndImageWith:(LPCostomLabelAndTextFieldAndImageView *)view click:(BOOL)click{
    self.timeTag = view.tag;
    if (view.tag == 0) {
        [self.pickTime show:self.timeView.secondTextField.text];
    }else{
        [self.pickTime show:self.endTimeView.secondTextField.text];
    }
    
    
    
}

#pragma mark - LPCostomChooseYearAndMonthAndDayDelegate
- (void)ChooseYearAndMonthAndDayAndHourAndMinuteWithTitle:(NSString *)string{
    if (self.timeTag == 0) {
        self.timeView.secondTextField.text = string;
    }else{
        self.endTimeView.secondTextField.text = string;
    }
    
}

#pragma mark - ZJIssueOrganizationSelectViewDelegate(发布页面--大口党组织--组织选择的弹窗视图) 协议方法
- (void)ZJIssueOrganizationSelectViewDelegate_cellSelected_Model:(ZJIssueOrganModel *)model{
    _organModel = model;
    [self.scopeView minUpdataUI_dataArray:@[@"本支部",model.DEPT_NAME,@"全区"] selectString:@"1"];
}

#pragma mark - ZJSIScopeViewDelegate
- (void)ZJSIScopeViewClick_scopeView:(ZJSIScopeView *)scopeView index:(NSInteger)index{
    NSString *string = [NSString stringWithFormat:@"%ld",(long)index + 1];
    if (scopeView == self.scopeView) {//公开范围
        _scopeString = string;
        if (_isStreet) {//街道书记
            string = [NSString stringWithFormat:@"%ld",(long)index + 2];
            _scopeString = string;
        }
        if (index == 1 && [_organizationType isEqualToString:@"1"]) {//大口党组织--组织选择
            [self addOrganizationselectview];
        }
    }else if (scopeView == self.onlineTopBotton){
        if (index == 0) {
            self.OnlineString = @"0";
        }else{
        
            self.OnlineString = @"1";
        }
    
    }
}
///添加选择视图 （大口党组织--组织选择）
- (void)addOrganizationselectview{
    self.organizationSelectView.alpha = 0;
    [self.view addSubview:self.organizationSelectView];
    [UIView animateWithDuration:0.5 animations:^{
        self.organizationSelectView.alpha = 1;
    }];
}

- (LPCostomLabelAndTextFieldAndImageView *)matterView{
    if (!_matterView) {
        _matterView = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0,  0, self.view.width, 80 * [UIScreen zj_screenHScale]) title:@"标题 :" placehold:@"请输入标题" imageString:@""];
        _matterView.secondTextField.userInteractionEnabled = YES;
        _matterView.maxNumber = 50;
    }
    return _matterView;
}

- (LPCostomJudgeIsOrFalseView *)partyDay{
    if (!_partyDay) {
        _partyDay = [[LPCostomJudgeIsOrFalseView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 40 * [UIScreen zj_screenHScale]) judge:@"是否主题党日活动"];
        _partyDay.delegate = self;
        _partyDay.tag = 1;
    }
    return _partyDay;
}

- (LPCostomJudgeIsOrFalseView *)volunteerAct{
    if (!_volunteerAct) {
        _volunteerAct = [[LPCostomJudgeIsOrFalseView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 40 * [UIScreen zj_screenHScale]) judge:@"是否志愿者活动"];
        _volunteerAct.delegate = self;
        _volunteerAct.tag = 2;
    }
    return _volunteerAct;
}


- (LPCostomLabelAndTextFieldAndImageView *)timeView{
    if (!_timeView) {
        _timeView = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 80 * [UIScreen zj_screenHScale]) title:@"开始时间 :" placehold:@"请选择时间" imageString:@"icon_calendar"];
        _timeView.tag = 0;
        _timeView.secondTextField.text = [NSString stringWithFormat:@"%@ 09:00",self.currentDay];
        _timeView.delegate = self;
        
    }
    return _timeView;
}

- (LPCostomLabelAndTextFieldAndImageView *)endTimeView{
    if (!_endTimeView) {
        _endTimeView = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 80 * [UIScreen zj_screenHScale]) title:@"结束时间 :" placehold:@"请选择时间" imageString:@"icon_calendar"];
        _endTimeView.delegate = self;
        _endTimeView.secondTextField.text = [NSString stringWithFormat:@"%@ 18:00",self.currentDay];
        _endTimeView.tag = 1;
        
    }
    return _endTimeView;
}

- (LPCostomLabelAndTextFieldAndImageView *)shareNumber{
    if (!_shareNumber) {
        _shareNumber = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0,0, self.view.width, 80 * [UIScreen zj_screenHScale]) title:@"共享人数 : (外部党员报名人数限制)" placehold:@"" imageString:@""];
        _shareNumber.secondTextField.userInteractionEnabled = YES;
        _shareNumber.secondTextField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
        _shareNumber.maxNumber = 50;
    }
    return _shareNumber;
}


- (ZJSILocationView *)actAddress{
    if (!_actAddress) {
        _actAddress = [[ZJSILocationView alloc]initWithFrame:CGRectMake(0, 0, self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"地址 :"];
        _actAddress.delegate = self;
        
    }
    return _actAddress;
}

- (UIButton *)sendButton{
    if (!_sendButton) {
        _sendButton = ({
            UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.view.width - 80 * [UIScreen zj_screenWScale], 45 * [UIScreen zj_screenHScale])];
            [button setTitle:@"发布活动" forState:UIControlStateNormal];
            [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            button.titleLabel.textAlignment = NSTextAlignmentCenter;
            button.titleLabel.font = LYPFONT(15);
            button.backgroundColor = [UIColor themeColor];
            [button addTarget:self action:@selector(clickButton) forControlEvents:UIControlEventTouchUpInside];
            button.layer.cornerRadius = 3;
            button.layer.masksToBounds = YES;
            button;
            
        });
    }
    return _sendButton;
}

- (UIScrollView *)backScrollView{
    if (!_backScrollView) {
        _backScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, LP_TopHeight, self.view.width, self.view.height - LP_TopHeight )];
        _backScrollView.contentOffset = CGPointMake(0, 0);
        _backScrollView.showsVerticalScrollIndicator = NO;
    }
    return _backScrollView;
    
}

- (ZJSIScopeView *)scopeView{
    if (_scopeView == nil){
        _scopeView = [[ZJSIScopeView alloc]initWithFrame:CGRectMake(0, 0, self.view.width, 195  * [UIScreen zj_screenHScale]) title:@"公开范围 :"];
        [_scopeView updataUI_dataArray:@[@"本支部",@"街镇党组织",@"全区"] selectString:nil];
        _scopeView.titleLabel.font = LYPFONT(17);
        _scopeView.delegate = self;
    }
    return _scopeView;
}


- (ZJSIScopeView *)onlineTopBotton{
    if (_onlineTopBotton == nil){
        _onlineTopBotton = [[ZJSIScopeView alloc]initWithFrame:CGRectMake(0, 0, self.view.width, 195  * [UIScreen zj_screenHScale]) title:@"活动类型 :"];
        [_onlineTopBotton minUpdataUI_dataArray:@[@"线下",@"线上"] selectString:@"线下"];
        _onlineTopBotton.titleLabel.font = LYPFONT(17);
        _onlineTopBotton.delegate = self;
    }
    return _onlineTopBotton;
}



- (LPCostomLabelAndTextViewAdaptHeightView *)jianjie{
    if (_jianjie == nil) {
        _jianjie = [[LPCostomLabelAndTextViewAdaptHeightView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 240 * [UIScreen zj_screenHScale]) title:@"主题 :" textViewHeight:200 * [UIScreen zj_screenHScale]];
        _jianjie.maxNumber = 200;
    }
    return _jianjie;
}

- (LPChooseYearAndMonthAndDayAndHourAndMinuteView *)pickTime{
    if (!_pickTime) {
        _pickTime  = [[LPChooseYearAndMonthAndDayAndHourAndMinuteView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
        _pickTime.delegate = self;
    }
    return _pickTime;
}
- (ZJIssueOrganizationSelectView *)organizationSelectView{
    if (_organizationSelectView == nil){
        _organizationSelectView = [[ZJIssueOrganizationSelectView alloc] initWithFrame:[UIScreen mainScreen].bounds];
        _organizationSelectView.delegate = self;
    }
    return _organizationSelectView;
}
@end
